home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / Developer Documentation / Recipes, Tech Notes & Articles / Tech Notes / Document Shell Design Overview < prev    next >
Encoding:
Text File  |  1995-07-24  |  6.1 KB  |  94 lines  |  [TEXT/ttxt]

  1. OpenDoc 1.0
  2. Document Shell design overview
  3. Created: September 29, 1994
  4. Updated: July 12, 1995
  5.  
  6. What is the Document Shell?
  7.  
  8. • A layer between the user and the various other OpenDoc subsystems
  9. • Initializer of the document process and platform toolbox
  10. • Creator of the ODSession object
  11. • Provider of the base ODMenuBar object
  12. • Handler of all document level content independent user actions
  13. • Handler of all document level content independent AppleEvents
  14. • The public class ODShellPlugIn
  15. • The private class RealShell
  16. • The function ShellMain
  17.  
  18. What is the Document Shell NOT?
  19.  
  20. • The Document Shell is NOT an application.
  21. • The Document Shell has NO inherent content of its own.
  22. Or, put another way, the Document Shell is content independent.  (I thought that sounded better than content-free. )
  23.  
  24. Who calls the Document Shell?
  25.  
  26. • The Document Stub Application, a copy of which is launched for every document, calls ShellMain.
  27. • The AppleEventManager calls the various AppleEvent handlers which the Shell registered whenever appropriate High Level Events come in.
  28.  
  29. Who does the Document Shell call?
  30.  
  31. • The platform specific process initialization api.  (e.g. InitGraf)
  32. • An ODSession object (creation & initialization)
  33. • An ODMenuBar object (creation & initialization)
  34. • The platform specific event gathering mechanism (WaitNextEvent)
  35. • The Dispatcher to dispatch those events
  36. • The StorageSystem to open, save a copy of, revert and close the Container, Document, and Draft for this process.
  37. • The set of OpenDoc Shell Plug-Ins which are installed on the current system.
  38. • The WindowState to open previously open windows of the draft
  39. • The Root Part to open a new window if there were no previously open windows
  40. • The DraftWindow class to list and manipulate the user drafts of the document
  41. • The platform specific file system browser (StandardFile) in response to the Open… command
  42.  
  43.  
  44. Which Document menu items does the Document Shell Handle?
  45.  
  46. • New - create a new document with the same kind as the root part of the frontmost window
  47. • Open Document… - display the platform specific file system browser and launch the selected document with the appropriate application.  If the user selects an OpenDoc document, then the Document Shell uses the same mechanism that the OpenDoc™ launcher application uses.
  48. • Close - close the frontmost window.  If that was the only document window then close the Container, Document, Draft and process.  Shutdown the session.  Holding down the option key changes this menu item to Close Document. Close Document is also what happens if the Shell receives a 'QUIT' event.
  49. • Delete Document - Close the current document (saving if necessary) and place in the trash.
  50. • Save - Save the current state of the document persistently.
  51. • Save A Copy… - Save a copy of the document into another user specified container.
  52. • Revert to Saved - Revert the document to the last persistently saved state.
  53. • Drafts - Display a drafts window and allow the user to create, open and delete drafts.
  54.  
  55. Who handles the other Document menu items?
  56.  
  57. • Open, Insert… - the active part, i.e. the part with the selection focus
  58. • Page Setup…, Print… - the root part of the frontmost window
  59.  
  60. How does the Document Shell open its document for editing?
  61.  
  62. The Document Shell gets the topmost draft in the document which represents the current persistent state of the document.  It then creates a temporary draft where changes to the document are stored until the user saves.  And finally it asks the WindowState object to internalize and display the windows which were previously open in the document.  If there were no previously open windows, then the Document Shell asks the Root Part to Open and display itself in a new window.
  63.  
  64. How does the Document Shell Save?
  65.  
  66. The Document Shell asks the WindowState, and the temporary draft, to externalize.  It then asks the temporary draft to save itself to the previous draft which represents the current persistent state of the document (SaveToPrevious).
  67.  
  68. How does the Document Shell Revert?
  69.  
  70. The Document Shell closes down everything which has been internalized from the temporary draft.  The temporary draft is emptied out, and the WindowState is reinternalized from the temporary draft.
  71.  
  72. How does the Document Shell Close A Window?
  73.  
  74. The Document Shell tells the Window to close.
  75.  
  76. How does the Document Shell Close the Whole Document?
  77.  
  78. If the Document Shell closes the last document window, then it proceeds to also close down the entire document and process.  First, the temporary draft is inspected to see if there were unsaved changes, and the user is given a chance to save them, discard them, or cancel the close.  Once the temporary draft has been cleared out, it is removed.  The document and container are released, which closes the document file. Finally the Dispatcher is instructed to Exit.
  79.  
  80. How does the Document Shell Save A Copy?
  81.  
  82. After the user specifies a new file using a platform specific file system browser (Standard PutFile on the Macintosh), the Document Shell creates a new Container, Document, and empty Draft.  This empty Draft is told to copy the temporary draft into itself.  The new Draft, Document & Container are released and the new file is closed.
  83.  
  84. What is the difference between User Drafts and Storage System Drafts?
  85.  
  86. • To the user, there is no current draft
  87. • User drafts mean PAST versions
  88.     A closed document with one storage draft has no user drafts.
  89.     However, a document with one user draft, when closed has two storage drafts, and when open has three storage drafts.
  90. • Documents start with one storage draft and no user drafts.
  91. • Every time the user creates a user draft, the Document Shell creates a storage draft.
  92. • When a document is closed or open readonly, the number of user drafts is the number of storage drafts minus one.  That one extra storage draft represents the current state of the document.  The user thinks of this as the document itself.
  93. • When open for editing, the document has two more storage drafts than user drafts, and therefore the number of user drafts is the number of storage drafts minus two.  The two extra storage drafts are the current persistent state of the document, and above that, the temporary draft where externalized storage units live until committed by a user Save action.
  94.